//
//  UIBarButtonItem+Extension.swift
//  WSWeiBo01
//
//  Created by 李维顺 on 16/7/12.
//  Copyright © 2016年 liweishun. All rights reserved.
//

import UIKit


extension UIBarButtonItem {
    
    
    convenience init(title: String, target: AnyObject?, action: Selector) {
        self.init()
        let button = UIButton()
        
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        //设置字体和颜色
        button.setTitle(title, forState: .Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Highlighted)
        
        button.titleLabel?.font = UIFont.systemFontOfSize(15)
        button.sizeToFit()
        
        customView = button
    }
    
    
}